package cn.yuan.org.service.impl;

import cn.yuan.basic.service.impl.BaseServiceImpl;
import cn.yuan.basic.util.PageList;
import cn.yuan.org.domain.DictionaryTypeDetail;
import cn.yuan.org.mapper.DictionaryTypeDetailMapper;
import cn.yuan.org.query.Query;
import cn.yuan.org.service.IDictionaryTypeDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DictionaryTypeDetailServiceImpl extends BaseServiceImpl<DictionaryTypeDetail> implements IDictionaryTypeDetailService {
    @Autowired
    private DictionaryTypeDetailMapper dictionaryTypeDetailMapper;
    @Override
    public PageList<DictionaryTypeDetail> getDictionaryTypeDetail(Query query) {
        return new PageList<DictionaryTypeDetail>(dictionaryTypeDetailMapper.queryTotal(query),dictionaryTypeDetailMapper.queryPageData(query));
    }

    @Override
    @Transactional
    public void delById(Long id) {
        dictionaryTypeDetailMapper.removeById(id);
    }

    @Override
    public PageList<DictionaryTypeDetail> getDetail(Query query) {
        return new PageList<DictionaryTypeDetail>(dictionaryTypeDetailMapper.queryCount(),dictionaryTypeDetailMapper.queryPage(query));
    }

    @Override
    @Transactional
    public void save(DictionaryTypeDetail dictionaryTypeDetail) {
        dictionaryTypeDetailMapper.save(dictionaryTypeDetail);
    }

    @Override
    @Transactional
    public void update(DictionaryTypeDetail dictionaryTypeDetail) {
        dictionaryTypeDetailMapper.update(dictionaryTypeDetail);
    }

    @Override
    public void delByTypesId(Long id) {
        dictionaryTypeDetailMapper.removeByTypesId(id);
    }
}
